unit ufTask_Property_ActionRunExtForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ufTask_Property_ActionCustom, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Grids, Vcl.ValEdit,
  ufTask_Property_ActionValuesEditor, uTasks;

type
  TfTask_Property_ActionRunExtForm = class(TTfTask_Property_ActionCustom)
    OpenDialog: TOpenDialog;
    lExtFormFileName: TLabel;
    eExtFormFileName: TButtonedEdit;
    fValuesEditor: TfTask_Property_ActionValuesEditor;
    procedure eExtFormFileNameRightButtonClick(Sender: TObject);
  private
    { Private declarations }
  public
    procedure Prepare(AStep: TStep); override;
    procedure Save; override;
    procedure Check; override;
  end;

implementation

{$R *.dfm}

uses
  u1cAgentServerConst;

procedure TfTask_Property_ActionRunExtForm.Check;
begin
  eExtFormFileName.Text:=Trim(eExtFormFileName.Text);
  if eExtFormFileName.Text='' then begin
    eExtFormFileName.SetFocus;
    raise Exception.Create(sSRV_41);
  end;
end;

procedure TfTask_Property_ActionRunExtForm.eExtFormFileNameRightButtonClick(Sender: TObject);
begin
  OpenDialog.InitialDir:= ExtractFilePath(eExtFormFileName.Text);
  if OpenDialog.Execute(Handle) then
    eExtFormFileName.Text:= OpenDialog.FileName;
end;

procedure TfTask_Property_ActionRunExtForm.Prepare(AStep: TStep);
begin
  inherited;
  eExtFormFileName.Text:=AStep.ExtModuleName;
  fValuesEditor.Prepare(AStep.ExtValues);
end;

procedure TfTask_Property_ActionRunExtForm.Save;
begin
  FStep.ExtModuleName:=eExtFormFileName.Text;
  fValuesEditor.Save;
end;

end.
